package com.sinothk.fc.reportform.controller;

import com.sinothk.fc.reportform.entity.*;
import com.sinothk.fc.reportform.service.IReportFormService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
* @Description: Home
* @Author: Liangyt
* @Date:   2022-10-14
* @Version: V1.0
*/
@Api(tags="reportForm")
@RestController
@RequestMapping("/fc/reportCtrl")
@Slf4j
public class ReportFormController {

   private final IReportFormService reportFormService;

    public ReportFormController(IReportFormService reportFormService) {
        this.reportFormService = reportFormService;
    }

    /**
     * 查询日常数据
     *
     * @return
     */
    @AutoLog(value = "查询日常数据")
    @ApiOperation(value="查询日常数据", notes="查询日常数据")
    @GetMapping(value = "/reportFormForDay")
    public Result<ReportFormForDay> reportFormForDay() throws Exception {
        ReportFormForDay reportFormData = reportFormService.reportFormForDay(new ReportFormReq());
        return Result.OK(reportFormData);
    }

    /**
     * 查询月数据
     *
     * @return
     */
    @AutoLog(value = "查询月数据")
    @ApiOperation(value="查询月数据", notes="查询月数据")
    @GetMapping(value = "/reportFormForMonth")
    public Result<ReportFormForMonth> reportFormForMonth() throws Exception {
        ReportFormForMonth reportFormData = reportFormService.reportFormForMonth();
        return Result.OK(reportFormData);
    }

    /**
     * 查询年数据
     *
     * @return
     */
    @AutoLog(value = "查询年数据")
    @ApiOperation(value="查询年数据", notes="查询年数据")
    @GetMapping(value = "/reportFormForYear")
    public Result<ReportFormForYear> reportFormForYear() throws Exception {
        ReportFormForYear reportFormData = reportFormService.reportFormForYear();
        return Result.OK(reportFormData);
    }

    /**
     * 查询三年数据
     *
     * @return
     */
    @AutoLog(value = "查询三年数据")
    @ApiOperation(value="查询三年数据", notes="查询三年数据")
    @GetMapping(value = "/reportFormFor3Year")
    public Result<ReportFormFor3Year> reportFormFor3Year() throws Exception {
        ReportFormFor3Year reportFormData = reportFormService.reportFormFor3Year();
        return Result.OK(reportFormData);
    }
}
